package com.ajieee.merge.entity.common.result;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;

import java.util.List;

/**
 * @author ajieee
 * @date 2025-11-01
 */
@Data
public class PageDTO<T> {

	private long total;

	private long current;

	private long size;

	private List<T> list;

	public static <T> PageDTO<T> from(Page<T> src) {
		PageDTO<T> result = new PageDTO<>();
		result.setTotal(src.getTotal());
		result.setCurrent(src.getCurrent());
		result.setSize(src.getSize());
		result.setList(src.getRecords());

		return result;
	}

}
